/*
 *  Shopbutton.h
 *  SpaceTrader
 *
 *  Created by Jake on 10/30/12.
 *  Copyright 2012 The Hex Pistols. All rights reserved.
 *
 */
#pragma once
#include<string>
#include "GuiTools.h"
#include <iostream>

enum shopbutton_state_t { SHOP_NONE, SHOP_MOUSEOVER, SHOP_CLICKED }; //don't mess with this :) it's bad style right now intentionally

class ShopButton
{
private:
    SDL_Rect bounds;
	SDL_Rect clip[8];
	SDL_Surface *icon;
    SDL_Surface *itemNameLabel;
    SDL_Surface *qtyLabel;
	int state;
    bool isHover;
	bool lastClicked;
    
    
    //copied from GuiButton... not good, we need to use inheritance
    TTF_Font* getFont(std::string s); 
    
public:
	void setColor(int priceDifference);

	ShopButton();
	ShopButton(int x, int y, std::string itemName, int qty);
    ShopButton(const ShopButton &S);
	~ShopButton();
    ShopButton& operator=(const ShopButton &S);
    
    void setInfo(std::string itemName, int qty);
	
	void setCoords(int x, int y);
    
    void show(SDL_Surface *screen);
    
    void setState(int state);
    
    int getState();
	
	void setLastClicked(bool);
    
    
    //bad bad bad bad bad, use inheritance
    //handles key presses
	shopbutton_state_t handle_input(SDL_Event event);
};
